package com.healthtop.dao;

import com.healthtop.mapper.XsRoleMenuMapper;
import com.healthtop.model.XsRoleMenu;
import com.healthtop.model.XsRoleMenuExample;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class XsRoleMenuDao {

    @Autowired
    private XsRoleMenuMapper xsRoleMenuMapper;

    public List<XsRoleMenu> selectByRoleId(long roleId) {
        XsRoleMenuExample example = new XsRoleMenuExample();
        example.createCriteria().andRoleIdEqualTo(roleId);
        return xsRoleMenuMapper.selectByExample(example);
    }

    public void delete(long roleId) {
        XsRoleMenuExample example = new XsRoleMenuExample();
        example.createCriteria().andRoleIdEqualTo(roleId);
        xsRoleMenuMapper.deleteByExample(example);
    }

    public void insert(XsRoleMenu xsRoleMenu) {
        xsRoleMenuMapper.insertSelective(xsRoleMenu);
    }
}
